<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=9" />
		<meta http-equiv="pragma" content="no-cache" />
		<title>新增文章</title>
		<%@ include file="../../common/Admin-list.jsp"%>		
		<script type="text/javascript" src="<%=bpath %>Scripts/jquery/jquery.colorpicker.js"></script> 	
		
		<!-- 配置文件 -->
	    <script type="text/javascript" src="<%=path %>/Scripts/UEditor/ueditor.config.js"></script>
	    <!-- 编辑器源码文件 -->
	    <script type="text/javascript" src="<%=path %>/Scripts/UEditor/ueditor.all.js"></script>		
		  
		<script type="text/javascript" src="<%=bpath %>Scripts/jquery/jquery.form.js"></script> 	
		
		<script type="text/javascript" src="<%=bpath %>Scripts/jquery/jquery.datetimepicker.js"></script> 
		 
		<script type="text/javascript">	
		
		$(function(){
			
			//标题颜色选择
			$("#cp4").colorpicker({
			    fillcolor:true,
			   // event:'mouseover',
			    success:function(o,color){
			        $("#title").css("color",color);
			        $("#titleColor").val(color);
			    }
			});
			$("#colorpanel").css("z-index",999);
			
			//保存
			$("#lnbSave").click(function(){								
				$("#addForm").ajaxSubmit({
					url:'../subjectMsg/save.json',
					type:"POST",
					beforeSubmit:checkForm,
					contentType:"application/x-www-form-urlencoded;charset=UTF-8",
					error:function(){},
					success:function(data){
						if(data.success==true){
							var win = art.dialog.open.origin;	
						    win.art.dialog({id: 'addMsgDialog'}).close();
						    win.refreshMsg(); 

						}else{
							//showTip("操作失败","warning");  
							art.dialog.alert('保存失败，请确认填写正确！');
						}
					}
				});
			});
			
			
		});
			
		function checkForm(){
			var flag=$('#addForm').form('validate');
			return true;
		}
				
		//消息提示  
		function showTip(mess,icon) {  
		    art.dialog({  
		        id : 'Tip',  
		        title : '消息',  
		        fixed : true,  
		        lock : true,  
		        opacity: .2,  
		        content : mess,  
		        icon : icon,  
		        time : 1  
		    });  
		    setTimeout('originReload()', 1000);  
		}  
		
		//重载来源页面  
		function originReload(){  
		    var win = art.dialog.open.origin;	
		    win.art.dialog({id: 'addMsgDialog'}).close();
		    win.refreshMsg(); 
		}		
		
		
		function changeIsLink(obj)
		{
			if(obj.checked==true)
			{
				$("#span_linkURL").show();/* .css("display","block") */
				/* $("#tr_summary").hide();
				$("#tr_container").hide(); */
			}else
			{
				$("#span_linkURL").hide();/* .css("display","none"); */
				/* $("#tr_summary").show();
				$("#tr_container").show(); */
			}
		}

		</script>
		
</head>
<body>
<!---->
<div>
	<div id="tab">
        <ul>
            <li class="Current">
            	<a href="#" onfocus="this.blur()">
            		<span id="lblTitle" >  新增文章  </span>
            	</a>
            </li>
        </ul>
    </div>  
    <div id="menu">
        <ul>
            <li>
            	<a id="lnbSave">
            		<span><img src="<%=basePath %>pages/Admin/Images/Icon/save.gif" alt="Save" />保存</span>
            	</a>
            </li>
        </ul>
    </div>   
    
    <div id="middle"> 
    <form action="../subjectMsg/save.json" id="addForm" name="addForm" method="post" >   
    <div class="editor">
        <table class="eTable">
             <tr class="eTr">
                <td class="name">
                   <label>文章标题：</label>	
                </td>
                <td>
                  	<input type="text" name="title" id="title" class="input"/>
                  	<input type="hidden" name="menu_id" id="menu_id" class="input" value="${data.menu_id }"/>
                  	<input type="hidden" name="state" id="state" class="input" value="0"/>
                </td>
            </tr> 
           
            <tr class="eTr">
                <td class="name">
                   <label>编辑：</label>	
                </td>
                <td>
                  	<input type="text" name="editor" id="editor" />
                </td>
            </tr>
            
             <tr class="eTr">
                <td class="name">
                   <label>作者：</label>	
                </td>
                <td>
                  	<input type="text" name="author" id="author" />
                </td>
            </tr>
             <tr class="eTr">
                <td class="name">
                   <label>数据来源：</label>	
                </td>
                <td>
                  	<input type="text" name="source_from" id="source_from" />
                </td>
            </tr>
            
            
             <tr class="eTr">
                <td class="name">
                   <label>是否图片：</label>	
                </td>
                <td>
                  	<input type="checkbox" name="istop" id="istop" value="1" />
                  	 <label>是否焦点：</label>	
                  	 <input type="checkbox" name="isfocus" id="isfocus" value="1" />
                </td>
            </tr>
            
            <tr class="eTr">
                <td class="name">
                   <label>是否外部文章：</label>	
                </td>
                <td>
                  	<input type="checkbox" onchange="changeIsLink(this);" name="isLink" id="isLink"  value="1" />
                  	
                
                  	
                </td>
            </tr>
            
              <tr class="eTr" id="span_linkURL"  style="display: none;">
	                <td class="name">
	                   <label>链接路径:：</label>	
	                </td>
                <td>
                    <input type="text" name="linkURL" id="linkURL"  class="input" />
                </td>
            </tr>  
            
            <tr class="eTr" >
	                <td class="name">
	                   <label>编辑时间:：</label>	
	                </td>
                <td>
                    <input type="text" name="createTime" id="createTime"  class="easyui-datebox"/>
                </td>
            </tr>  
        	<tr class="eTr"  id="tr_summary">
	                <td class="name">
	                   <label>简介：</label>	
	                </td>
                <td>
                    <textarea rows="3"  name="summary" id="summary" ></textarea>
                </td>
            </tr> 
           
            <!-- 百度编辑器  -->            
            <tr class="eTr" id="tr_container"> 
            <td class="name">
                   <label>内容：</label>	
                </td>               
                <td  >
                	<!-- 加载编辑器的容器 -->
				    <script id="container" name="content" type="text/plain" style="width:1200px;height:200px;">
        				这里写你的初始化内容-----bff测试测试！！！！！！！！
    				</script>
                </td>
            </tr>
            
            
        </table>
        
    </div>
    </form> 
    </div>
    
    <!-- 实例化编辑器 -->
    <script type="text/javascript">
        var ue = UE.getEditor('container',{
        	autoHeight: false,
        	autoClearinitialContent:true, //清除初始内容       
        	autoHeightEnabled: false,//是否自动长高，默认true
          	autoFloatEnabled:false, //是否保持toolbar的位置不动，默认true        	
          	topOffset :65        	//浮动时工具栏距离浏览器顶部的高度，用于某些具有固定头部的页面
        });        
              
       ue.ready(function() {
		    ue.setContent('${data.articleList.content}');
		  
		});		
    </script>
    
</div>
</body>
</html>